package org.springframework.context.support;

import android.util.Log;
import com.h2.org.springframework.beans.Bean;
import com.h2.org.springframework.beans.Bean.BeanType;
import com.h2.org.springframework.beans.ConstructorArg;
import com.h2.org.springframework.beans.IBeanListener;
import com.h2.org.springframework.beans.IValueBean;
import com.h2.org.springframework.beans.PropertyBean;
import com.h2.org.springframework.beans.UtilBean;
import com.h2.org.springframework.beans.factory.DResourceManager;
import com.h2.org.springframework.beans.factory.IResourceManager;
import com.h2.org.springframework.beans.factory.ResourceResolver;
import com.h2.org.springframework.beans.factory.SimpleBeanFactory;
import com.h2.org.springframework.beans.factory.config.DefaultPlaceholderResolver;
import com.h2.util.lang.reflect.ReflectUtils;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.Stack;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.PlaceholderResolver;
import org.springframework.util.ReflectionUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class ClassPathXmlApplicationContext extends AbstractApplicationContext
{
  private static final String TAG = "ClassPathXmlApplicationContext";
  private Collection<IBeanListener> _beanListeners = new ArrayList();
  private Map<String, Bean> _beanPreProcess = new HashMap();
  private Stack<Bean> _beanStack = new Stack();
  private PropertyPlaceholderConfigurer.PlaceholderResolver _placeholderResolver;
  private Properties _properties = new Properties();
  protected IResourceManager _resorceManager = new DResourceManager();
  private ResourceResolver _resourceResolver = new ResourceResolver();
  private Stack<IValueBean> _valueBeanStack = new Stack();

  public ClassPathXmlApplicationContext()
  {
  }

  public ClassPathXmlApplicationContext(String paramString)
  {
    SimpleBeanFactory localSimpleBeanFactory = new SimpleBeanFactory();
    setBeanFactory(localSimpleBeanFactory);
    processContext(paramString);
    preProcess(localSimpleBeanFactory);
    postProcess(localSimpleBeanFactory);
  }

  private Bean initBean(Bean paramBean)
  {
    paramBean.setProperties(new HashMap());
    paramBean.setBeanProperties(new ArrayList());
    paramBean.setType(Bean.BeanType.OBJECT);
    return paramBean;
  }

  private void preProcess(final SimpleBeanFactory paramSimpleBeanFactory)
  {
    Collection localCollection = getBeanPreProcess().values();
    ArrayList localArrayList = new ArrayList();
    Iterator localIterator1 = localCollection.iterator();
    Iterator localIterator2;
    if (!localIterator1.hasNext())
      localIterator2 = localArrayList.iterator();
    while (true)
    {
      final Bean localBean;
      while (true)
      {
        while (true)
        {
          if (localIterator2.hasNext())
            break label459;
          return;
          localBean = (Bean)localIterator1.next();
          if ("org.springframework.beans.factory.config.PropertyPlaceholderConfigurer".equals(localBean.getClazzName()))
          {
            processBean(paramSimpleBeanFactory, localBean);
            processInnerBean(paramSimpleBeanFactory, localBean);
            PropertyPlaceholderConfigurer localPropertyPlaceholderConfigurer = (PropertyPlaceholderConfigurer)localBean.getInstantiatedObject();
            try
            {
              getProperties().load(getResorceManager().getResource(getResourceResolver().resolvePath(localPropertyPlaceholderConfigurer.getLocation())));
              setPlaceholderResolver(new DefaultPlaceholderResolver()
              {
                public String getPlaceholder(String paramAnonymousString)
                {
                  return ClassPathXmlApplicationContext.this.getProperties().getProperty(paramAnonymousString);
                }
              });
            }
            catch (IOException localIOException)
            {
              while (true)
              {
                Log.e("ClassPathXmlApplicationContext", localIOException.getMessage());
                Log.d("ClassPathXmlApplicationContext", "Details: ", localIOException);
              }
            }
          }
        }
        if ("org.springframework.beans.factory.config.MethodInvokingFactoryBean".equals(localBean.getClazzName()))
        {
          Method localMethod;
          if (localBean.getProperties().containsKey("staticMethod"))
          {
            String str2 = (String)localBean.getProperties().get("staticMethod");
            int i = str2.lastIndexOf('.');
            String str3 = str2.substring(0, i);
            String str4 = str2.substring(i + 1);
            localMethod = ReflectionUtils.findMethod(BeanUtils.getClass(str3), str4);
          }
          try
          {
            localBean.setInstantiatedObject(localMethod.invoke(null, new Object[0]));
            localBean.setClazz(localMethod.getReturnType());
            paramSimpleBeanFactory.addBean(localBean);
            localArrayList.add(localBean);
          }
          catch (IllegalArgumentException localIllegalArgumentException)
          {
            while (true)
            {
              Log.e("ClassPathXmlApplicationContext", localIllegalArgumentException.getMessage());
              Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalArgumentException);
            }
          }
          catch (IllegalAccessException localIllegalAccessException)
          {
            while (true)
            {
              Log.e("ClassPathXmlApplicationContext", localIllegalAccessException.getMessage());
              Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalAccessException);
            }
          }
          catch (InvocationTargetException localInvocationTargetException)
          {
            while (true)
            {
              Log.e("ClassPathXmlApplicationContext", localInvocationTargetException.getMessage());
              Log.d("ClassPathXmlApplicationContext", "Details: ", localInvocationTargetException);
            }
          }
        }
      }
      if (localBean.getDependsOn() != null)
      {
        getBeanListeners().add(new IBeanListener()
        {
          public void afterInitialization(Bean paramAnonymousBean)
          {
            if (localBean.getDependsOn().equals(paramAnonymousBean.getNameResolved()))
              ClassPathXmlApplicationContext.this.postProcessDependency(paramSimpleBeanFactory, localBean);
          }
        });
        localArrayList.add(localBean);
        break;
      }
      if (!(localBean instanceof UtilBean))
        break;
      String str1 = guessUtilBeanType((UtilBean)localBean);
      if (str1 == null)
        break;
      ((UtilBean)localBean).setValueType(str1);
      break;
      label459: localCollection.remove((Bean)localIterator2.next());
    }
  }

  private void processBeanConstructorArg(XmlPullParser paramXmlPullParser)
  {
    int i = paramXmlPullParser.getAttributeCount();
    ConstructorArg localConstructorArg = (ConstructorArg)getValueBeanStack().peek();
    int j = 0;
    if (j >= i)
      return;
    String str1 = paramXmlPullParser.getAttributeName(j);
    String str2 = paramXmlPullParser.getAttributeValue(j);
    if ("value".equals(str1))
      localConstructorArg.setValue(str2);
    while (true)
    {
      j++;
      break;
      if ("type".equals(str1))
        localConstructorArg.setType(str2);
      else if ("ref".equals(str1))
        localConstructorArg.setType(str2);
      else if ("name".equals(str1))
        localConstructorArg.setName(str2);
      else if ("index".equals(str1))
        localConstructorArg.setIndex(Integer.valueOf(Integer.parseInt(str2)));
    }
  }

  private void processPropertyBeanAttributes(XmlPullParser paramXmlPullParser)
  {
    IValueBean localIValueBean = (IValueBean)getValueBeanStack().peek();
    int i = paramXmlPullParser.getAttributeCount();
    int j = 0;
    if (j >= i)
      return;
    String str1 = paramXmlPullParser.getAttributeName(j);
    String str2 = paramXmlPullParser.getAttributeValue(j);
    if ("name".equals(str1))
      localIValueBean.setName(str2);
    while (true)
    {
      j++;
      break;
      if ("value".equals(str1))
        localIValueBean.setValue(str2);
    }
  }

  protected Object evaluateProperty(SimpleBeanFactory paramSimpleBeanFactory, Bean paramBean, IValueBean paramIValueBean, Method paramMethod)
  {
    Object localObject;
    if (paramIValueBean.getRef() != null)
      localObject = getBeanFactory().getBean(paramIValueBean.getRef());
    String str1;
    do
    {
      return localObject;
      if (paramIValueBean.getBean() != null)
      {
        processBean(paramSimpleBeanFactory, paramIValueBean.getBean());
        processInnerBean(paramSimpleBeanFactory, paramIValueBean.getBean());
        return paramIValueBean.getBean().getInstantiatedObject();
      }
      if ((paramIValueBean.getValue() != null) && ((paramBean instanceof UtilBean)))
      {
        if (getPlaceholderResolver() == null);
        for (String str3 = paramIValueBean.getValue(); ; str3 = getPlaceholderResolver().resolvePlaceholder(paramIValueBean.getValue()))
          return BeanUtils.convertToBean(str3, ((UtilBean)paramBean).getValueType());
      }
      str1 = paramIValueBean.getValue();
      localObject = null;
    }
    while (str1 == null);
    if (getPlaceholderResolver() == null);
    for (String str2 = paramIValueBean.getValue(); ; str2 = getPlaceholderResolver().resolvePlaceholder(paramIValueBean.getValue()))
      return BeanUtils.convertToBean(str2, paramMethod.getParameterTypes()[0]);
  }

  public Collection<IBeanListener> getBeanListeners()
  {
    return this._beanListeners;
  }

  public Map<String, Bean> getBeanPreProcess()
  {
    return this._beanPreProcess;
  }

  public Stack<Bean> getBeanStack()
  {
    return this._beanStack;
  }

  public PropertyPlaceholderConfigurer.PlaceholderResolver getPlaceholderResolver()
  {
    return this._placeholderResolver;
  }

  public Properties getProperties()
  {
    return this._properties;
  }

  public IResourceManager getResorceManager()
  {
    return this._resorceManager;
  }

  public ResourceResolver getResourceResolver()
  {
    return this._resourceResolver;
  }

  public Stack<IValueBean> getValueBeanStack()
  {
    return this._valueBeanStack;
  }

  protected String guessUtilBeanType(UtilBean paramUtilBean)
  {
    String str = null;
    if (paramUtilBean.getValueType() != null)
      return paramUtilBean.getValueType();
    Iterator localIterator = paramUtilBean.getBeanProperties().iterator();
    while (true)
    {
      if (!localIterator.hasNext())
        return str;
      IValueBean localIValueBean = (IValueBean)localIterator.next();
      if (localIValueBean.getRef() != null)
      {
        Bean localBean = (Bean)getBeanPreProcess().get(localIValueBean.getRef());
        if (localBean.getClazzName() != null)
          str = localBean.getClazzName();
      }
      else if (localIValueBean.getBean() != null)
      {
        str = localIValueBean.getBean().getClazzName();
      }
    }
  }

  protected void postProcess(SimpleBeanFactory paramSimpleBeanFactory)
  {
    Collection localCollection = getBeanPreProcess().values();
    Iterator localIterator1 = localCollection.iterator();
    Iterator localIterator2;
    if (!localIterator1.hasNext())
      localIterator2 = localCollection.iterator();
    while (true)
    {
      if (!localIterator2.hasNext())
      {
        return;
        processBean(paramSimpleBeanFactory, (Bean)localIterator1.next());
        break;
      }
      processInnerBean(paramSimpleBeanFactory, (Bean)localIterator2.next());
    }
  }

  protected void postProcessDependency(SimpleBeanFactory paramSimpleBeanFactory, Bean paramBean)
  {
    processBean(paramSimpleBeanFactory, paramBean);
    processInnerBean(paramSimpleBeanFactory, paramBean);
  }

  protected void processBean(final SimpleBeanFactory paramSimpleBeanFactory, final Bean paramBean)
  {
    if (paramBean.getInstantiatedObject() != null)
      return;
    Object localObject1;
    if (paramBean.getFactoryBean() != null)
    {
      localObject1 = getBeanFactory().getBean(paramBean.getFactoryBean());
      if (localObject1 == null)
        getBeanListeners().add(new IBeanListener()
        {
          public void afterInitialization(Bean paramAnonymousBean)
          {
            if (paramBean.getFactoryBean().equals(paramAnonymousBean.getNameResolved()))
              ClassPathXmlApplicationContext.this.postProcessDependency(paramSimpleBeanFactory, paramBean);
          }
        });
    }
    else if (paramBean.getClazzName() != null)
    {
      paramBean.setClazz(BeanUtils.getClass(paramBean.getClazzName()));
      if ((paramBean.getConstructorArgs() != null) && (!paramBean.getConstructorArgs().isEmpty()))
        break label318;
      paramBean.setInstantiatedObject(BeanUtils.instantiate(paramBean.getClazz()));
    }
    while (true)
    {
      while (true)
      {
        paramSimpleBeanFactory.addBean(paramBean);
        return;
        try
        {
          localObject2 = localObject1.getClass().getMethod(paramBean.getFactoryMethod(), new Class[0]).invoke(localObject1, new Object[0]);
          if (localObject2 == null)
            Log.w("ClassPathXmlApplicationContext", "Reference is null: " + paramBean.getFactoryMethod());
        }
        catch (SecurityException localSecurityException)
        {
          Object localObject2;
          Log.e("ClassPathXmlApplicationContext", localSecurityException.getMessage());
          Log.d("ClassPathXmlApplicationContext", "Details: ", localSecurityException);
          break;
          paramBean.setInstantiatedObject(localObject2);
          paramBean.setClazz(localObject2.getClass());
        }
        catch (NoSuchMethodException localNoSuchMethodException)
        {
          Log.e("ClassPathXmlApplicationContext", localNoSuchMethodException.getMessage());
          Log.d("ClassPathXmlApplicationContext", "Details: ", localNoSuchMethodException);
        }
        catch (IllegalArgumentException localIllegalArgumentException)
        {
          Log.e("ClassPathXmlApplicationContext", localIllegalArgumentException.getMessage());
          Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalArgumentException);
        }
        catch (IllegalAccessException localIllegalAccessException)
        {
          Log.e("ClassPathXmlApplicationContext", localIllegalAccessException.getMessage());
          Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalAccessException);
        }
        catch (InvocationTargetException localInvocationTargetException)
        {
          Log.e("ClassPathXmlApplicationContext", localInvocationTargetException.getMessage());
          Log.d("ClassPathXmlApplicationContext", "Details: ", localInvocationTargetException);
        }
      }
      break;
      label318: Object[] arrayOfObject = processConstructors(paramBean);
      paramBean.setInstantiatedObject(BeanUtils.instantiateClass(paramBean.getClazz(), arrayOfObject));
    }
  }

  public void processBeanAttributes(XmlPullParser paramXmlPullParser)
  {
    Bean localBean = (Bean)getBeanStack().peek();
    int i = paramXmlPullParser.getAttributeCount();
    int j = 0;
    if (j >= i)
      return;
    String str1 = paramXmlPullParser.getAttributeName(j);
    String str2 = paramXmlPullParser.getAttributePrefix(j);
    String str3 = paramXmlPullParser.getAttributeValue(j);
    if ("p".equals(str2))
      if (str1.endsWith("-ref"))
      {
        PropertyBean localPropertyBean = new PropertyBean();
        localPropertyBean.setName(str1.substring(0, str1.length() - "-ref".length()));
        localPropertyBean.setRef(str3);
        localBean.getBeanProperties().add(localPropertyBean);
      }
    while (true)
    {
      j++;
      break;
      localBean.getProperties().put(str1, str3);
      continue;
      if ("id".equals(str1))
        localBean.setId(str3);
      else if ("name".equals(str1))
        localBean.setName(str3);
      else if ("class".equals(str1))
        localBean.setClazzName(str3);
      else if ("init-method".equals(str1))
        localBean.setInitMethod(str3);
      else if ("abstract".equals(str1))
        localBean.setAbstract(Boolean.valueOf(Boolean.parseBoolean(str3)));
      else if ("parent".equals(str1))
        localBean.setParent(str3);
      else if ("scope".equals(str1))
        localBean.setScope(str3);
      else if ("factory-bean".equals(str1))
        localBean.setFactoryBean(str3);
      else if ("factory-method".equals(str1))
        localBean.setFactoryMethod(str3);
      else if ("depends-on".equals(str1))
        localBean.setDependsOn(str3);
    }
  }

  protected Object[] processConstructors(Bean paramBean)
  {
    Constructor localConstructor = ReflectUtils.getConstructor(paramBean.getClazz(), Integer.valueOf(paramBean.getConstructorArgs().size()));
    Object[] arrayOfObject1;
    if (localConstructor == null)
    {
      Object[] arrayOfObject2 = new Object[2];
      arrayOfObject2[0] = paramBean.getClazz();
      arrayOfObject2[1] = Integer.valueOf(paramBean.getConstructorArgs().size());
      Log.e("ClassPathXmlApplicationContext", String.format("Constructor does not exist in %s for %d", arrayOfObject2));
      arrayOfObject1 = null;
      return arrayOfObject1;
    }
    int j;
    for (int i = 0; ; i++)
    {
      if (i >= paramBean.getConstructorArgs().size())
      {
        j = 0;
        if (j < paramBean.getConstructorArgs().size())
          break label208;
        arrayOfObject1 = new Object[paramBean.getConstructorArgs().size()];
        for (int k = 0; k < paramBean.getConstructorArgs().size(); k++)
          arrayOfObject1[k] = ((ConstructorArg)paramBean.getConstructorArgs().get(k)).getInstantiatedObject();
        break;
      }
      ConstructorArg localConstructorArg1 = (ConstructorArg)paramBean.getConstructorArgs().get(i);
      if (localConstructorArg1.getType() == null)
        localConstructorArg1.setType(localConstructor.getParameterTypes()[i].getName());
    }
    label208: ConstructorArg localConstructorArg2 = (ConstructorArg)paramBean.getConstructorArgs().get(j);
    Object localObject;
    if (localConstructorArg2.getRef() != null)
      localObject = getBeanFactory().getBean(localConstructorArg2.getRef());
    String str1;
    do
    {
      Bean localBean;
      do
      {
        localConstructorArg2.setInstantiatedObject(localObject);
        j++;
        break;
        localBean = localConstructorArg2.getBean();
        localObject = null;
      }
      while (localBean != null);
      str1 = localConstructorArg2.getValue();
      localObject = null;
    }
    while (str1 == null);
    if (getPlaceholderResolver() == null);
    for (String str2 = localConstructorArg2.getValue(); ; str2 = getPlaceholderResolver().resolvePlaceholder(localConstructorArg2.getValue()))
    {
      localObject = BeanUtils.convertToBean(str2, localConstructor.getParameterTypes()[j]);
      break;
    }
  }

  // ERROR //
  protected void processContext(String paramString)
  {
    // Byte code:
    //   0: ldc_w 597
    //   3: invokestatic 602	java/lang/System:getProperty	(Ljava/lang/String;)Ljava/lang/String;
    //   6: aconst_null
    //   7: invokestatic 608	org/xmlpull/v1/XmlPullParserFactory:newInstance	(Ljava/lang/String;Ljava/lang/Class;)Lorg/xmlpull/v1/XmlPullParserFactory;
    //   10: astore 14
    //   12: aload 14
    //   14: astore 5
    //   16: aload 5
    //   18: iconst_1
    //   19: invokevirtual 612	org/xmlpull/v1/XmlPullParserFactory:setNamespaceAware	(Z)V
    //   22: aload 5
    //   24: invokevirtual 616	org/xmlpull/v1/XmlPullParserFactory:newPullParser	()Lorg/xmlpull/v1/XmlPullParser;
    //   27: astore 12
    //   29: aload_0
    //   30: invokevirtual 169	org/springframework/context/support/ClassPathXmlApplicationContext:getResorceManager	()Lcom/h2/org/springframework/beans/factory/IResourceManager;
    //   33: new 618	java/io/File
    //   36: dup
    //   37: aload_0
    //   38: invokevirtual 173	org/springframework/context/support/ClassPathXmlApplicationContext:getResourceResolver	()Lcom/h2/org/springframework/beans/factory/ResourceResolver;
    //   41: aload_1
    //   42: invokevirtual 180	com/h2/org/springframework/beans/factory/ResourceResolver:resolvePath	(Ljava/lang/String;)Ljava/lang/String;
    //   45: invokespecial 619	java/io/File:<init>	(Ljava/lang/String;)V
    //   48: invokeinterface 623 2 0
    //   53: astore 13
    //   55: aload 12
    //   57: aload 13
    //   59: invokeinterface 627 2 0
    //   64: aload_0
    //   65: aload 12
    //   67: invokevirtual 630	org/springframework/context/support/ClassPathXmlApplicationContext:processDocument	(Lorg/xmlpull/v1/XmlPullParser;)V
    //   70: aload 13
    //   72: invokevirtual 635	java/io/Reader:close	()V
    //   75: return
    //   76: astore_2
    //   77: ldc 8
    //   79: aload_2
    //   80: invokevirtual 636	org/xmlpull/v1/XmlPullParserException:getMessage	()Ljava/lang/String;
    //   83: invokestatic 208	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   86: pop
    //   87: ldc 8
    //   89: ldc 210
    //   91: aload_2
    //   92: invokestatic 214	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   95: pop
    //   96: aconst_null
    //   97: astore 5
    //   99: goto -83 -> 16
    //   102: astore 9
    //   104: ldc 8
    //   106: aload 9
    //   108: invokevirtual 636	org/xmlpull/v1/XmlPullParserException:getMessage	()Ljava/lang/String;
    //   111: invokestatic 208	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   114: pop
    //   115: ldc 8
    //   117: ldc 210
    //   119: aload 9
    //   121: invokestatic 214	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   124: pop
    //   125: return
    //   126: astore 6
    //   128: ldc 8
    //   130: aload 6
    //   132: invokevirtual 202	java/io/IOException:getMessage	()Ljava/lang/String;
    //   135: invokestatic 208	android/util/Log:e	(Ljava/lang/String;Ljava/lang/String;)I
    //   138: pop
    //   139: ldc 8
    //   141: ldc 210
    //   143: aload 6
    //   145: invokestatic 214	android/util/Log:d	(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    //   148: pop
    //   149: return
    //
    // Exception table:
    //   from	to	target	type
    //   0	12	76	org/xmlpull/v1/XmlPullParserException
    //   22	75	102	org/xmlpull/v1/XmlPullParserException
    //   22	75	126	java/io/IOException
  }

  public void processDocument(XmlPullParser paramXmlPullParser)
    throws XmlPullParserException, IOException
  {
    int i = paramXmlPullParser.getEventType();
    if (i == 0)
      Log.i("ClassPathXmlApplicationContext", "Start Document");
    while (true)
    {
      i = paramXmlPullParser.next();
      if (i != 1)
        break;
      return;
      if (i == 1)
        Log.i("ClassPathXmlApplicationContext", "End document");
      else if (i == 2)
        processStartElement(paramXmlPullParser);
      else if (i == 3)
        processEndElement(paramXmlPullParser);
      else if (i == 4)
        processText(paramXmlPullParser);
    }
  }

  public void processEndElement(XmlPullParser paramXmlPullParser)
  {
    String str = paramXmlPullParser.getName();
    if (("bean".equals(str)) || ("list".equals(str)) || ("set".equals(str)) || ("map".equals(str)))
    {
      Bean localBean = (Bean)getBeanStack().pop();
      if ((!getBeanStack().isEmpty()) && ((getBeanStack().peek() instanceof UtilBean)))
      {
        PropertyBean localPropertyBean = new PropertyBean();
        localPropertyBean.setBean(localBean);
        ((Bean)getBeanStack().peek()).getBeanProperties().add(localPropertyBean);
      }
      while (true)
      {
        if ((getBeanStack().isEmpty()) && (localBean.getNameResolved() != null))
          getBeanPreProcess().put(localBean.getNameResolved(), localBean);
        return;
        if (!getValueBeanStack().isEmpty())
          ((IValueBean)getValueBeanStack().peek()).setBean(localBean);
      }
    }
    if (("property".equals(str)) || ("ref".equals(str)))
    {
      ((Bean)getBeanStack().peek()).getBeanProperties().add((IValueBean)getValueBeanStack().pop());
      return;
    }
    if ("constructor-arg".equals(str))
    {
      ((Bean)getBeanStack().peek()).getConstructorArgs().add((ConstructorArg)getValueBeanStack().pop());
      return;
    }
    "properties".equals(str);
  }

  protected void processImportAttributes(XmlPullParser paramXmlPullParser)
  {
    int i = paramXmlPullParser.getAttributeCount();
    for (int j = 0; ; j++)
    {
      if (j >= i)
        return;
      String str1 = paramXmlPullParser.getAttributeName(j);
      String str2 = paramXmlPullParser.getAttributeValue(j);
      if ("resource".equals(str1))
        processContext(str2);
    }
  }

  protected void processInitMethod(Bean paramBean)
  {
    if (paramBean.getInitMethod() != null);
    try
    {
      Method localMethod2 = paramBean.getClazz().getMethod(paramBean.getInitMethod(), new Class[0]);
      localMethod1 = localMethod2;
      if (localMethod1 == null)
      {
        Object[] arrayOfObject = new Object[2];
        arrayOfObject[0] = paramBean.getClazz();
        arrayOfObject[1] = paramBean.getInitMethod();
        Log.e("ClassPathXmlApplicationContext", String.format("Method does not exist in %s for %s", arrayOfObject));
        return;
      }
      try
      {
        localMethod1.invoke(paramBean.getInstantiatedObject(), new Object[0]);
        return;
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
        Log.e("ClassPathXmlApplicationContext", localIllegalArgumentException.getMessage());
        Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalArgumentException);
        return;
      }
      catch (IllegalAccessException localIllegalAccessException)
      {
        Log.e("ClassPathXmlApplicationContext", localIllegalAccessException.getMessage());
        Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalAccessException);
        return;
      }
      catch (InvocationTargetException localInvocationTargetException)
      {
        Log.e("ClassPathXmlApplicationContext", localInvocationTargetException.getMessage());
        Log.d("ClassPathXmlApplicationContext", "Details: ", localInvocationTargetException);
        return;
      }
    }
    catch (NoSuchMethodException localNoSuchMethodException)
    {
      while (true)
        localMethod1 = null;
    }
    catch (SecurityException localSecurityException)
    {
      while (true)
        Method localMethod1 = null;
    }
  }

  protected void processInnerBean(SimpleBeanFactory paramSimpleBeanFactory, Bean paramBean)
  {
    Collection localCollection = paramBean.getBeanProperties();
    Method localMethod4;
    Iterator localIterator4;
    label78: Iterator localIterator3;
    if (localCollection != null)
    {
      if (!(paramBean instanceof UtilBean))
        break label369;
      if ((!(paramBean.getInstantiatedObject() instanceof List)) && (!(paramBean.getInstantiatedObject() instanceof Set)))
        break label332;
      localMethod4 = ReflectionUtils.findMethod(paramBean.getInstantiatedObject().getClass(), "add", new Class[] { Object.class });
      localIterator4 = localCollection.iterator();
      if (localIterator4.hasNext())
        break label140;
      Map localMap = paramBean.getProperties();
      if (localMap != null)
      {
        localIterator3 = localMap.entrySet().iterator();
        label103: if (localIterator3.hasNext())
          break label693;
      }
    }
    processInitMethod(paramBean);
    Iterator localIterator1 = getBeanListeners().iterator();
    while (true)
    {
      while (true)
      {
        while (true)
        {
          if (localIterator1.hasNext())
            break label1001;
          return;
          label140: Object localObject3 = evaluateProperty(paramSimpleBeanFactory, paramBean, (IValueBean)localIterator4.next(), localMethod4);
          try
          {
            localMethod4.invoke(paramBean.getInstantiatedObject(), new Object[] { localObject3 });
          }
          catch (IllegalArgumentException localIllegalArgumentException3)
          {
            Log.e("ClassPathXmlApplicationContext", localIllegalArgumentException3.getMessage());
            Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalArgumentException3);
            Log.e("ClassPathXmlApplicationContext", "Method: " + localMethod4);
          }
          catch (IllegalAccessException localIllegalAccessException3)
          {
            Log.e("ClassPathXmlApplicationContext", localIllegalAccessException3.getMessage());
            Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalAccessException3);
            Log.e("ClassPathXmlApplicationContext", "Method: " + localMethod4);
          }
          catch (InvocationTargetException localInvocationTargetException3)
          {
            Log.e("ClassPathXmlApplicationContext", localInvocationTargetException3.getMessage());
            Log.d("ClassPathXmlApplicationContext", "Details: ", localInvocationTargetException3);
            Log.e("ClassPathXmlApplicationContext", "Method: " + localMethod4);
          }
        }
        break;
        label332: if (!(paramBean.getInstantiatedObject() instanceof Map))
          break label78;
        ReflectionUtils.findMethod(List.class, "put", new Class[] { Object.class, Object.class });
        break label78;
        label369: Iterator localIterator2 = localCollection.iterator();
        while (localIterator2.hasNext())
        {
          IValueBean localIValueBean = (IValueBean)localIterator2.next();
          Method localMethod1 = ReflectUtils.getSetterMethod(paramBean.getClazz(), localIValueBean.getName());
          if (localMethod1 == null)
          {
            Object[] arrayOfObject2 = new Object[2];
            arrayOfObject2[0] = paramBean.getClazz();
            arrayOfObject2[1] = localIValueBean.getName();
            Log.e("ClassPathXmlApplicationContext", String.format("Method does not exist in %s for %s", arrayOfObject2));
          }
          else
          {
            Object localObject1 = evaluateProperty(paramSimpleBeanFactory, paramBean, localIValueBean, localMethod1);
            if (localObject1 == null)
            {
              Object[] arrayOfObject1 = new Object[2];
              arrayOfObject1[0] = paramBean.getClazz();
              arrayOfObject1[1] = localIValueBean.getName();
              Log.e("ClassPathXmlApplicationContext", String.format("Reference is null for %s %s.", arrayOfObject1));
            }
            else
            {
              try
              {
                localMethod1.invoke(paramBean.getInstantiatedObject(), new Object[] { localObject1 });
              }
              catch (IllegalArgumentException localIllegalArgumentException1)
              {
                Log.e("ClassPathXmlApplicationContext", localIllegalArgumentException1.getMessage());
                Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalArgumentException1);
                Log.e("ClassPathXmlApplicationContext", "Method: " + localMethod1);
              }
              catch (IllegalAccessException localIllegalAccessException1)
              {
                Log.e("ClassPathXmlApplicationContext", localIllegalAccessException1.getMessage());
                Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalAccessException1);
                Log.e("ClassPathXmlApplicationContext", "Method: " + localMethod1);
              }
              catch (InvocationTargetException localInvocationTargetException1)
              {
                Log.e("ClassPathXmlApplicationContext", localInvocationTargetException1.getMessage());
                Log.d("ClassPathXmlApplicationContext", "Details: ", localInvocationTargetException1);
                Log.e("ClassPathXmlApplicationContext", "Method: " + localMethod1);
              }
            }
          }
        }
        break label78;
        label693: Map.Entry localEntry = (Map.Entry)localIterator3.next();
        Method localMethod2 = ReflectUtils.getSetterMethod(paramBean.getClazz(), (String)localEntry.getKey());
        if (localMethod2 == null)
        {
          Object[] arrayOfObject4 = new Object[2];
          arrayOfObject4[0] = paramBean.getClazz();
          arrayOfObject4[1] = localEntry.getKey();
          Log.e("ClassPathXmlApplicationContext", String.format("Method does not exist in %s for %s", arrayOfObject4));
          break label103;
        }
        if (getPlaceholderResolver() == null);
        Object localObject2;
        Method localMethod3;
        for (String str = (String)localEntry.getValue(); ; str = getPlaceholderResolver().resolvePlaceholder((String)localEntry.getValue()))
        {
          localObject2 = BeanUtils.convertToBean(str, localMethod2.getParameterTypes()[0]);
          localMethod3 = ReflectUtils.getSetterMethod(paramBean.getClazz(), (String)localEntry.getKey(), localMethod2.getParameterTypes()[0]);
          if (localMethod3 != null)
            break label901;
          Object[] arrayOfObject3 = new Object[2];
          arrayOfObject3[0] = paramBean.getClazz();
          arrayOfObject3[1] = localEntry.getKey();
          Log.e("ClassPathXmlApplicationContext", String.format("Method does not exist in %s for %s", arrayOfObject3));
          break;
        }
        try
        {
          label901: localMethod3.invoke(paramBean.getInstantiatedObject(), new Object[] { localObject2 });
        }
        catch (IllegalArgumentException localIllegalArgumentException2)
        {
          Log.e("ClassPathXmlApplicationContext", localIllegalArgumentException2.getMessage());
          Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalArgumentException2);
        }
        catch (IllegalAccessException localIllegalAccessException2)
        {
          Log.e("ClassPathXmlApplicationContext", localIllegalAccessException2.getMessage());
          Log.d("ClassPathXmlApplicationContext", "Details: ", localIllegalAccessException2);
        }
        catch (InvocationTargetException localInvocationTargetException2)
        {
          Log.e("ClassPathXmlApplicationContext", localInvocationTargetException2.getMessage());
          Log.d("ClassPathXmlApplicationContext", "Details: ", localInvocationTargetException2);
        }
      }
      break label103;
      label1001: ((IBeanListener)localIterator1.next()).afterInitialization(paramBean);
    }
  }

  protected void processRef(XmlPullParser paramXmlPullParser)
  {
    int i = paramXmlPullParser.getAttributeCount();
    for (int j = 0; ; j++)
    {
      if (j >= i)
        return;
      String str1 = paramXmlPullParser.getAttributeName(j);
      String str2 = paramXmlPullParser.getAttributeValue(j);
      if (("local".equals(str1)) || ("bean".equals(str1)))
        ((IValueBean)getValueBeanStack().peek()).setRef(str2);
    }
  }

  public void processStartElement(XmlPullParser paramXmlPullParser)
  {
    String str = paramXmlPullParser.getName();
    if ("bean".equals(str))
    {
      Bean localBean4 = initBean(new Bean());
      getBeanStack().push(localBean4);
      processBeanAttributes(paramXmlPullParser);
      Log.d("ClassPathXmlApplicationContext", "Created: " + localBean4);
    }
    do
    {
      do
      {
        return;
        if ("property".equals(str))
        {
          PropertyBean localPropertyBean1 = new PropertyBean();
          getValueBeanStack().push(localPropertyBean1);
          processPropertyBeanAttributes(paramXmlPullParser);
          Log.d("ClassPathXmlApplicationContext", "Created: " + localPropertyBean1);
          return;
        }
        if ("constructor-arg".equals(str))
        {
          ConstructorArg localConstructorArg = new ConstructorArg();
          getValueBeanStack().push(localConstructorArg);
          processBeanConstructorArg(paramXmlPullParser);
          return;
        }
      }
      while ("value".equals(str));
      if ("ref".equals(str))
      {
        PropertyBean localPropertyBean2 = new PropertyBean();
        getValueBeanStack().push(localPropertyBean2);
        processRef(paramXmlPullParser);
        return;
      }
      if ("list".equals(str))
      {
        Bean localBean3 = initBean(new UtilBean());
        getBeanStack().push(localBean3);
        localBean3.setClazzName(ArrayList.class.getName());
        processUtilBeanAttributes(paramXmlPullParser);
        return;
      }
      if ("set".equals(str))
      {
        Bean localBean2 = initBean(new UtilBean());
        getBeanStack().push(localBean2);
        localBean2.setClazzName(HashSet.class.getName());
        processUtilBeanAttributes(paramXmlPullParser);
        return;
      }
      if ("map".equals(str))
      {
        Bean localBean1 = initBean(new UtilBean());
        getBeanStack().push(localBean1);
        localBean1.setClazzName(HashMap.class.getName());
        processUtilBeanAttributes(paramXmlPullParser);
        return;
      }
    }
    while (("properties".equals(str)) || (!"import".equals(str)));
    processImportAttributes(paramXmlPullParser);
  }

  public void processText(XmlPullParser paramXmlPullParser)
    throws XmlPullParserException
  {
    String str = paramXmlPullParser.getText();
    if (str.matches("\\s*"));
    do
    {
      return;
      if ((!getBeanStack().isEmpty()) && ((getBeanStack().peek() instanceof UtilBean)))
      {
        PropertyBean localPropertyBean = new PropertyBean();
        localPropertyBean.setValue(str);
        ((Bean)getBeanStack().peek()).getBeanProperties().add(localPropertyBean);
        return;
      }
    }
    while (getValueBeanStack().isEmpty());
    ((IValueBean)getValueBeanStack().peek()).setValue(str);
  }

  public void processUtilBeanAttributes(XmlPullParser paramXmlPullParser)
  {
    UtilBean localUtilBean = (UtilBean)getBeanStack().peek();
    int i = paramXmlPullParser.getAttributeCount();
    int j = 0;
    if (j >= i)
      return;
    String str1 = paramXmlPullParser.getAttributeName(j);
    String str2 = paramXmlPullParser.getAttributeValue(j);
    if ("id".equals(str1))
      localUtilBean.setId(str2);
    while (true)
    {
      j++;
      break;
      if ("name".equals(str1))
        localUtilBean.setName(str2);
      else if ("scope".equals(str1))
        localUtilBean.setScope(str2);
      else if (str1.endsWith("-class"))
        localUtilBean.setClazzName(str2);
      else if ("value-type".equals(str1))
        localUtilBean.setValueType(str2);
    }
  }

  public void setBeanListeners(Collection<IBeanListener> paramCollection)
  {
    this._beanListeners = paramCollection;
  }

  public void setBeanPreProcess(Map<String, Bean> paramMap)
  {
    this._beanPreProcess = paramMap;
  }

  public void setBeanStack(Stack<Bean> paramStack)
  {
    this._beanStack = paramStack;
  }

  public void setPlaceholderResolver(PropertyPlaceholderConfigurer.PlaceholderResolver paramPlaceholderResolver)
  {
    this._placeholderResolver = paramPlaceholderResolver;
  }

  public void setProperties(Properties paramProperties)
  {
    this._properties = paramProperties;
  }

  public void setResorceManager(IResourceManager paramIResourceManager)
  {
    this._resorceManager = paramIResourceManager;
  }

  public void setResourceResolver(ResourceResolver paramResourceResolver)
  {
    this._resourceResolver = paramResourceResolver;
  }

  public void setValueBeanStack(Stack<IValueBean> paramStack)
  {
    this._valueBeanStack = paramStack;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     org.springframework.context.support.ClassPathXmlApplicationContext
 * JD-Core Version:    0.6.2
 */